home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / gnu / gnu_oleo_1_2_2.lha / oleo-1.2.2 / window.h < prev    next >
C/C++ Source or Header  |  1993-03-03  |  6KB  |  213 lines

  1.  
  2. #ifndef WINDOWH
  3. #define WINDOWH
  4.  
  5. /*    Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2, or (at your option)
  10. any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this software; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20. /*  t. lord    Mon Aug 10 14:51:25 1992    */
  21.  
  22. #include "cell.h"
  23. #include "line.h"
  24.  
  25. /* The tty windows datastructures: */
  26.  
  27.  
  28. struct window
  29. {
  30.   /* Do not change these directly. */
  31.   int id;
  32.   int win_over;            /* Where the data in this window starts */
  33.   int win_down;            /*   on the screen.  */
  34.   struct rng screen;        /* Cells visible. recenter_* updates this. */
  35.   int flags;            /* You must use io_set_win_flags and perhaps */
  36.                 /*   io_recenter_cur_win */
  37.  
  38.   /* Number of lines of spreadsheet that can fit in this window.
  39.      This only changes when the screen is resized,
  40.      win->flags&WIN_EDGES changes, or a window is either
  41.      created or destroyed */
  42.   int numr;
  43.   
  44.   /* Number of text columns that can fit in this window.
  45.      This changes when the screen is resized,
  46.      win->flags&WIN_EDGES changes, a window is created or
  47.      destoryed, or win->lh_wid changes.  In the last case
  48.      win->numc+win->lh_wid remains a constant. */
  49.   int numc;
  50.   
  51.   /* 
  52.    * Number of columns and rows for right and bottom edges. 
  53.    * As this changes, numc and numr change accordingly.
  54.    */
  55.   int bottom_edge_r;
  56.   int right_edge_c;
  57.  
  58.   /* These values may be changed at any time. */
  59.   /* -1 if this window isn't linked to any others, else
  60.      contains the index into wins of the window this one is
  61.      linked to */
  62.   int link;
  63.  
  64.   /* Number of columns taken up by the row numbers at the
  65.      left hand edge of the screen.  Zero if edges is
  66.      win->flags&WIN_EDGES is off (by definition).  Seven (or
  67.      five) if win->flags&WIN_PAG_HZ (to make things easier).
  68.      Ranges between three "R9 " to seven "R32767 " depending on
  69.      the number of the highest row on the screen.  */
  70.   int lh_wid;
  71.  
  72.   
  73.   /* Cursor row/column in this window */
  74.   /* Note that the external variables curow, cucol are used for
  75.      the currently active cursor position, so if you want
  76.      cwin->curow and cwin->cucol to be accurate, you have to
  77.      set them yourself. */
  78.   CELLREF curow,cucol;
  79.  
  80.   VOIDSTAR *win_slops;    /* Slops in this window (tty only) */
  81. };
  82.  
  83. struct mouse_event
  84. {
  85.   int seq;
  86.   int row;
  87.   int col;
  88.   int button;
  89.   int downp;
  90.   int location;            /* See #defines, below. */
  91.   CELLREF r;
  92.   CELLREF c;
  93.   struct mouse_event * next;
  94.   struct mouse_event * prev;
  95. };
  96.  
  97. /* Window flags:
  98.    0x01    Locked horizontally
  99.    0x02    Locked vertically
  100.    0x04    Page Horizontally
  101.    0x08    Page Vertically
  102.    0x10    Edges disabled
  103.    0x20    Edges standout
  104.    */
  105. #define WIN_LCK_HZ    0x01
  106. #define WIN_LCK_VT    0x02
  107. #define WIN_PAG_HZ    0x04
  108. #define WIN_PAG_VT    0x08
  109. #define WIN_EDGES    0x10
  110. #define WIN_EDGE_REV    0x20
  111.  
  112. /* Do not change these directly. */
  113. extern int scr_lines;
  114. extern int scr_cols;
  115. extern int input;        /* An approximation that makes sense. */
  116. extern int status;
  117. extern int user_input;        /* What the user actually asked for. */
  118. extern int user_status;
  119. extern int formulas_visible;
  120. extern int input_rows;
  121. extern int status_rows;
  122. extern int label_rows;
  123. extern int label_emcols;
  124.  
  125. extern int nwin;
  126. extern struct window * wins;
  127. extern struct window * cwin;
  128.  
  129. /* 
  130.  * When the input area is active, it appears to be just another window,
  131.  * reachable by other-window.  These values must be maintained by any
  132.  * implementation of io_get_line.
  133.  */
  134. extern int window_after_input;    /* Id of the window prior to the input area. */
  135. extern int input_active;    /* Bool: is the input area selected? */
  136.  
  137.  
  138. #ifdef __STDC__
  139. extern void io_read_window_config (char *);
  140. extern void io_write_window_config (struct line *);
  141. extern void io_init_windows (int sl, int sc, int ui, int us,
  142.                  int ir, int sr, int lr, int lc);
  143. extern void io_set_scr_size (int lines, int cols);
  144. extern void io_set_input_status (int irows, int srows, int doredraw);
  145. extern void io_set_formula_visability (int);
  146. extern void io_set_input_rows (int);
  147. extern void io_set_status_rows (int);
  148.  
  149. extern void io_win_open (int horizp, int where);
  150. extern void io_win_close (struct window *);
  151. extern void io_set_cwin (struct window *);
  152. extern void io_move_cell_cursor (CELLREF, CELLREF);
  153. extern void io_shift_cell_cursor (int dirn);
  154. extern void io_scroll_cell_cursor (int dirn);
  155. extern void io_pr_cell (CELLREF r, CELLREF c, CELL *);
  156. extern void io_redo_region (struct rng * rng);
  157. extern void io_recenter_cur_win (void);
  158. extern void io_recenter_all_win (void);
  159.  
  160. extern int win_label_rows (struct window * win);
  161. extern int win_label_cols (struct window * win, CELLREF last_row);
  162.  
  163. extern void io_set_win_flags (struct window *, int f);
  164. extern int enqueue_mouse_event (int r, int c, int button, int downp);
  165. extern void dequeue_mouse_event (struct mouse_event * out, int seq);
  166.  
  167. #else
  168.  
  169. extern void io_read_window_config ();
  170. extern void io_write_window_config ();
  171. extern void io_init_windows ();
  172. extern void io_set_scr_size ();
  173. extern void io_set_input_status ();
  174. extern void io_set_formula_visability ();
  175. extern void io_set_input_rows ();
  176. extern void io_set_status_rows ();
  177.  
  178. extern void io_win_open ();
  179. extern void io_win_close ();
  180. extern void io_set_cwin ();
  181. extern void io_move_cell_cursor ();
  182. extern void io_shift_cell_cursor ();
  183. extern void io_scroll_cell_cursor ();
  184. extern void io_pr_cell ();
  185. extern void io_redo_region ();
  186.  
  187. extern void io_recenter_cur_win ();
  188. extern void io_recenter_all_win ();
  189.  
  190. extern int win_label_rows ();
  191. extern int win_label_cols ();
  192.  
  193. extern void io_set_win_flags ();
  194. extern int enqueue_mouse_event ();
  195. extern void dequeue_mouse_event ();
  196. #endif
  197.  
  198. extern struct mouse_event last_mouse_event;
  199.  
  200.  
  201. /* This is stored as the button number when a dequeue failes. */
  202. #define MOUSE_QERROR    -1
  203. /* These are the possible mouse locations. */
  204. #define MOUSE_ON_INPUT    -1
  205. #define MOUSE_ON_STATUS   -2
  206. #define MOUSE_ON_EDGE      -3
  207.  
  208. #define MOUSE_CHAR '\034'
  209.  
  210. #endif
  211.  
  212.  
  213.